package edu.sctu.zhengsenwen.month201506.day20150615.files;


import java.io.*;

/**
 * Created by user15 on 2015/6/14.
 */
public class FileReaderAndWrite {

    public FileReaderAndWrite() throws FileNotFoundException {

        char[] buffer = new char[1];
        try {

            //字符流输出
            FileReader fileReader = new FileReader(new File("D://HarryPote//zsw.txt"));

            FileWriter fileWrite = new FileWriter(new File("D://HarryPote//zswwwwwwwww.txt"));

            try {
                while ((fileReader.read(buffer)) != -1) {

                    fileWrite.write(buffer, 0, buffer.length);

                    System.out.println(buffer);
                }

                try {
                   fileReader.close();

                    fileWrite.close();
                } catch (Exception ex) {

                    ex.printStackTrace();
                }


            } catch (Exception ex) {
                ex.printStackTrace();
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }


    public static void main(String[] args) {

        try {
            new FileReaderAndWrite();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
}
